<template>
    <div class="newsinfo-container">
        <h3 class="title">{{newlist.title}}</h3>
        <p class="info">
            <span>发表时间：{{newlist.add_time | dateFormate}}</span>
            <span>点击：{{newlist.click}}次</span></p>
        <hr>
        <div class="content" v-html="newlist.content"></div>
        <!-- 父组件向子组件传值  注意 ： -->
        <comment :newsid="id"></comment>
    </div>
</template>
<script>
    import comment from '../sub-components/Comment.vue'
    export default {
        data() {
            return {
                newlist: {},
            };
        },
        methods: {
            getNewInfo() {
                this.$http.get("/api/getnew/" + this.id).then(result => {
                  
                    if (result.data.status === 0)
                        this.newlist = result.data.message[0]

                })

            },
            
        },
        created() {
            this.getNewInfo();
            
        },
        props: ['id'],
        components: {
            comment: comment
        }
    }
</script>
<style lang="scss" scoped>
    .newsinfo-container {
        padding: 3px;

        .title {
            font-size: 15px;
            text-align: center;
            color: red
        }

        .info {
            color: #26a2ff;
            display: flex;
            justify-content: space-between;
        }
    }
</style>